package WuHanTrainStation;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

//第一管理员菜单类
public class firstAdministratorMenu {
    public void administratorStart() throws IOException, ClassNotFoundException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        administratorUtility administratorUtility = new administratorUtility();
        Use use = new Use();
        int judgment = 0;
        do {
            System.out.println("1.注册");
            System.out.println("2.登录");
            System.out.println("3.找回密码");
            System.out.println("4.找回密保问题");
            System.out.println("5.退出");
            switch (bufferedReader.readLine()) {
                case "1":
                    administratorUtility.administratorRegistered();
                    use.utilityUse();
                    judgment = 1;
                    break;
                case "2":
                    administratorUtility.administratorLogin();
                    judgment = 0;
                    break;
                case "3":
                    administratorUtility.administratorBackPassword();
                    use.utilityUse();
                    judgment = 1;
                    break;
                case "4":
                    administratorUtility.administratorBackKey();
                    use.utilityUse();
                    judgment = 1;
                    break;
                case "5":
                    System.exit(0);
                default:
                    System.out.println("功能号不存在！请正确输入功能号！");
                    judgment = 1;
                    break;
            }
        } while (judgment == 1);
    }

    public void administratorUtility() throws IOException, ClassNotFoundException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        administratorUtility administratorUtility = new administratorUtility();
        Functional functional = new Functional();
        Analysis analysis = new Analysis();
        Use use = new Use();
        secondAdministratorMenu secondAdministratorMenu = new secondAdministratorMenu();
        thirdAdministratorMenu thirdAdministratorMenu = new thirdAdministratorMenu();
        int judgment = 0;
        do {
            System.out.println("******欢迎登录武汉铁路局铁路管理系统******");
            System.out.println("******武汉铁路局铁路管理系统******\n" +
                    "一、项目设计分析\n" +
                    "该武汉铁路局管理系统主要用于管理员对铁路信息进行录入，删除，修改，查询，对车辆信息的分析等操作，和用户对于铁路信息的查询以及老铁路迷对车辆信息的分析，方便铁路迷进行诸多在铁路圈流行的但主流12306网站上没有实现的功能。设计该系统的目的主要是为了方便乘客快速乘车并且方便铁路迷拍车以及刷车工作。\n" +
                    "二、程序功能简介\n" +
                    "\t该系统主要有以下八个功能：\n" +
                    "1、\t登录注册功能：用户可以用用户账号登录系统，管理员可以用管理员账号登录系统。\n" +
                    "2、\t密保设置与找回功能：用户可以对用户账号进行密保设置以及密保和密码的找回，管理员可以对管理员账号进行密保设置以及密保和密码的找回。\n" +
                    "3、\t修改密码与修改密保功能：用户可以对用户账号进行密码修改和密保修改，管理员可以对管理员账号进行密码修改和密保修改。\n" +
                    "4、\t录入车辆信息：只有管理员登录时才可以录入车辆信息，登录后按照主菜单提示，选择车辆信息，之后进入二级菜单选择录入车辆信息，根据提示进行相应操作。\n" +
                    "5、\t删除车辆信息：只有管理员登录时才可以删除车辆信息，登录后按照主菜单提示，选择车辆信息，之后进入二级菜单选择删除车辆信息，再之后根据系统提示按照所需条件删除车辆信息。\n" +
                    "6、\t更改学生信息：只有管理员登录时才可以更改车辆信息，登录后按照主菜单提示，选择车辆信息，之后进入二级菜单选择更改车辆信息，再之后根据系统提示按照所要更改的条件更改相应的车辆信息。\n" +
                    "7、\t查询车辆信息：用户和管理员登录时都可以查询车辆信息，登录后按照主菜单提示，选择车辆信息，之后进入二级菜单选择查询车辆信息，再之后根据系统提示按照所要查询的条件查询车辆信息。\n" +
                    "8、\t分析车辆信息：用户和管理员登录时都可以查看分析的车辆信息，登录后按照主菜单提示，选择车辆信息，之后进入二级菜单选择查看分析车辆信息，再之后根据系统提示按照所要查询的条件查询分析的车辆信息。\n" +
                    "输入规则：车次：若是字母和数字组成的，字母只能为TKDGCLZAY\n" +
                    "数字只能为1~7，且位数为四位以下\n" +
                    "到达时间：例：12:20\n" +
                    "出发时间：例：12:20\n" +
                    "车辆类型：TKDGCLZAY\n" +
                    "场：汉字。\n" +
                    "车站: 汉字。\n" +
                    "账号，密码，密保问题，密保答案：无要求。\n");
            System.out.println("1.个人信息");
            System.out.println("  11.修改密码");
            System.out.println("  12.修改密保问题");
            System.out.println("  13.设置密保问题");
            System.out.println("2.车辆信息");
            System.out.println("  21.增加车辆信息");
            System.out.println("  22.删除车辆信息");
            System.out.println("    221.按车次删除");
            System.out.println("    222.按到达时间删除");
            System.out.println("    223.按出发时间删除");
            System.out.println("    224.按车辆类型删除");
            System.out.println("    225.按场删除");
            System.out.println("    226.按车站删除");
            System.out.println("  23.更改车辆信息");
            System.out.println("    231.更改车次");
            System.out.println("    232.更改到达时间");
            System.out.println("    233.更改出发时间");
            System.out.println("    234.更改车辆类型");
            System.out.println("    235.更改场");
            System.out.println("    236.更改车站");
            System.out.println("  24.查询车辆信息");
            System.out.println("    241.查询车次");
            System.out.println("    242.查询到达时间");
            System.out.println("    243.查询出发时间");
            System.out.println("    244.查询车辆种类");
            System.out.println("    245.查询场");
            System.out.println("    246.查询车站");
            System.out.println("  25.分析车辆信息");
            System.out.println("    251.分析车次");
            System.out.println("    252.分析到达时间");
            System.out.println("    253.分析出发时间");
            System.out.println("    254.分析车辆种类");
            System.out.println("    255.分析场");
            System.out.println("    256.分析车站");
            System.out.println("3.退出");
            switch (bufferedReader.readLine()) {
                case "1":
                    secondAdministratorMenu.chooseOne();
                    break;
                case "11":
                    administratorUtility.administratorModifyPassword();
                    use.use();
                    judgment = 1;
                    break;
                case "12":
                    administratorUtility.administratorModifyKey();
                    use.use();
                    judgment = 1;
                    break;
                case "13":
                    administratorUtility.administratorKey();
                    use.use();
                    judgment = 1;
                    break;
                case "2":
                    secondAdministratorMenu.chooseTwo();
                    break;
                case "21":
                    functional.add();
                    use.use();
                    judgment = 1;
                    break;
                case "22":
                    thirdAdministratorMenu.chooseTwoTwo();
                    break;
                case "221":
                    functional.deleteTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "222":
                    functional.deleteArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "223":
                    functional.deleteDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "224":
                    functional.deleteType();
                    use.use();
                    judgment = 1;
                    break;
                case "225":
                    functional.deleteField();
                    use.use();
                    judgment = 1;
                    break;
                case "226":
                    functional.deleteStation();
                    use.use();
                    judgment = 1;
                    break;
                case "23":
                    thirdAdministratorMenu.chooseTwoThree();
                    break;
                case "231":
                    functional.changeTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "232":
                    functional.changeArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "233":
                    functional.changeDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "234":
                    functional.changeType();
                    use.use();
                    judgment = 1;
                    break;
                case "235":
                    functional.changeField();
                    use.use();
                    judgment = 1;
                    break;
                case "236":
                    functional.changeStation();
                    use.use();
                    judgment = 1;
                    break;
                case "24":
                    thirdAdministratorMenu.chooseTwoFour();
                    break;
                case "241":
                    functional.queryTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "242":
                    functional.queryArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "243":
                    functional.queryDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "244":
                    functional.queryType();
                    use.use();
                    judgment = 1;
                    break;
                case "245":
                    functional.queryField();
                    use.use();
                    judgment = 1;
                    break;
                case "246":
                    functional.queryStation();
                    use.use();
                    judgment = 1;
                    break;
                case "25":
                    thirdAdministratorMenu.chooseTwoFive();
                    break;
                case "251":
                    analysis.analysisTrains();
                    use.use();
                    judgment = 1;
                    break;
                case "252":
                    analysis.analysisArrivingTime();
                    use.use();
                    judgment = 1;
                    break;
                case "253":
                    analysis.analysisDepartureTime();
                    use.use();
                    judgment = 1;
                    break;
                case "254":
                    analysis.analysisType();
                    use.use();
                    judgment = 1;
                    break;
                case "255":
                    analysis.analysisField();
                    use.use();
                    judgment = 1;
                    break;
                case "256":
                    analysis.analysisStation();
                    use.use();
                    judgment = 1;
                    break;
                case "3":
                    System.exit(0);
                default:
                    System.out.println("功能号不存在！请正确输入功能号！");
                    judgment = 1;
                    break;
            }
        } while (judgment == 1);
    }
}